# 方法1
def change(s):
    b = ""
    q = ""
    num = 0
    for i in s:
        if i.isupper():
            b += i.lower()
        elif i.islower():
            b += i.upper()
        else:
            b += i

    for r in b:
        num += 1
        if r.isspace():
            break

    q += b[num:len(b)]
    q += " "
    q += b[0:num]

    return q

s = "Hello World ewr"

# 方法2
def func(s):
    l = s.split(' ')
    l = l[::-1]
    s = ""
    for i in l:
        i = i.swapcase()   # 字符串中小写变大写，大写变小写
        s += i
        s += " "
    return s[0:len(s)-1]

print(func(s))




a = "faf frr"
l = a.split(' ')     # 在指定的地方隔开形成列表,并去除指定的元素
print(l)